<link rel='stylesheet' type='text/css' href='<?php echo $this->baseUrl() ?>/public/css/jquery-ui/jquery-ui-1.10.3.css'/>
<script src='<?php echo $this->baseUrl() ?>/public/js/jquery-ui-1.10.3.js'></script>
<script src='<?php echo $this->baseUrl() ?>/public/js/generalinfo.js'></script>
<script src='http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js'></script>

<link rel='stylesheet' type='text/css' href='<?php echo $this->baseUrl() ?>/public/css/input.css'/>
<div id="input-content">
    <form id='general_info' method='POST' enctype="multipart/form-data">
        <input type="hidden" name="general_id" value="<?php echo $this->general_information['id'] ?>"/>
        <div class="input-step" id="wrap-general-info">
            <table class="timeline" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <th class="current" scope="col">General infomation</th>
                    <th scope="col">Dunnage</th>
                    <th scope="col">Tally</th>
                    <th scope="col">Cargo supervision</th>
                </tr>
            </table>
            <div class="step-content">
                <form action="#">
                    <div class="cleft">
                        <div class="item">
                            <label for='refno'>Ref No.</label>
                            <div class="reselect">
                                <span><?php echo $this->ref_no ?></span>
                                <input type="hidden" value="<?php echo $this->ref_no ?>" name="ref_no"/>
                            </div>
                        </div>
                        <div class="item">
                            <label for="customer_name">Customer Name</label>
                            <div class="reselect">
                                <select name="customer_name" id='customter_name'>
                                    <option value='-1'>--Select Customter Name--</option>
                                    <?php foreach ($this->customers as $customer): ?>
                                        <option <?php if (isset($this->general_information) && $customer->id == $this->general_information['customer_id']): ?>selected <?php endif; ?> value='<?php echo $customer->id ?>'><?php echo $customer->fullname ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                        </div>
                        <div class="item">
                            <label for="shipname">Ship Name</label>
                            <div class="reselect">
                                <input <?php if (isset($this->general_information)): ?> value="<?php echo $this->general_information['ship_name'] ?>" <?php endif; ?>type="text" name='ship_name' id='ship_name' placeholder="Enter Text"/>
                            </div>
                        </div>
                        <div class="item">
                            <label for='port_of_call'>Port Of Call</label>
                            <div class="reselect">
                                <select name='port_of_call' id="port_of_call">
                                    <option value='-1'>--Select Port--</option>
                                    <?php foreach ($this->ports as $port): ?>
                                        <option <?php echo isset($this->general_information) && ($port->id == $this->general_information['port_id']) ? 'selected' : "" ?> value='<?php echo $port->id ?>'><?php echo $port->name ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                        </div>
                        <div class="item">
                            <label for='buoy'>Buoy Name</label>
                            <div class="reselect">
                                <select name='buoy_name' id="buoy_name">
                                    <option value='0'>--Select Buoy Name--</option>
                                    <?php foreach ($this->buoys as $buoy): ?>
                                        <option <?php echo isset($this->general_information) && ($buoy->id == $this->general_information['buoy_id']) ? 'selected' : "" ?> 
                                            value='<?php echo $buoy->id ?>'>
                                                <?php echo $buoy->name ?>
                                        </option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                        </div>
                        <div class="item">
                            <label for="cargo_quantity">Cargo Quantity</label>
                            <div class="reselect">
                                <select id='cargo_unit' name='cargo_unit' style='width: 20%;float:right'>
                                    <option <?php if (isset($this->general_information) && 'mt' == $this->general_information['cargo_unit']): ?> selected <?php endif; ?> value='mt'>mt</option>
                                    <option <?php if (isset($this->general_information) && 'cbm' == $this->general_information['cargo_unit']): ?> selected <?php endif; ?> value='cbm'>cbm</option>
                                </select>
                                <input <?php if (isset($this->general_information)): ?>value="<?php echo $this->general_information['cargo_quantity'] ?>" <?php endif; ?> type="text" name='cargo_quantity' id='cargo_quantity'style='width: 75%;margin-right: 10px;' placeholder="Enter Text"/>
                            </div>
                        </div>
                    </div>
                    <div class="cright">
                        <div class="item">
                            <label for="eta">ETA</label>
                            <div class="reselect">
                                <input <?php if (isset($this->general_information)): ?>value="<?php echo date(DATE_FORMAT, $this->general_information['eta']); ?>" <?php endif; ?> type="text" name='eta' class='datetime' placeholder="Enter Datetime"/>
                            </div>
                        </div>
                        <div class="item">
                            <label for="eta">ATA</label>
                            <div class="reselect">
                                <input <?php if (isset($this->general_information)): ?>value="<?php echo date(DATE_FORMAT, $this->general_information['ata']); ?>" <?php endif; ?>  type="text" name='ata' class='datetime' placeholder="Enter Datetime"/>
                            </div>
                        </div>
                        <div class="item">
                            <label for="ets">ETS</label>
                            <div class="reselect">
                                <input  <?php if (isset($this->general_information)): ?>value="<?php echo date(DATE_FORMAT, $this->general_information['ets']); ?>" <?php endif; ?>  type="text" name='ets' class='datetime' placeholder="Enter Datetime"/>
                            </div>
                        </div>
                        <div class="item">
                            <label for="ata">ATS</label>
                            <div class="reselect">
                                <input  <?php if (isset($this->general_information)): ?>value="<?php echo date(DATE_FORMAT, $this->general_information['ats']); ?>" <?php endif; ?>  type="text" name='ats' class='datetime' placeholder="Enter Datetime"/>
                            </div>
                        </div>
                        <div class="item">
                            <label for="ship_on_arrival">Ship On Arrival</label>
                            <div class="reselect">
                                <input type="file" name='ship_on_arrival' id="ship_on_arrival"/>
                                <?php if (isset($this->general_information)): ?>
                                    <div style="width: 60%">
                                        <img alt="No image" height="10%" style='padding:10px 0px;' src="<?php echo UPLOAD_URL . $this->general_information['ship_on_arrival'] ?>"/>
                                    </div>
                                <?php endif; ?>       
                            </div>
                        </div>
                        <div class="item">
                            <label for="ship_on_arrival">Ship On Departure</label>
                            <div class="reselect">
                                <input type="file" name='ship_on_departure' id="ship_on_departure"/>
                                <?php if (isset($this->general_information)): ?>
                                    <div style="width: 60%">
                                        <img alt="No image" height="10%" style='padding:10px 0px;' src="<?php echo UPLOAD_URL . $this->general_information['ship_on_departure'] ?>"/>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </form>
                <div style="clear: both;">&nbsp;</div>
            </div>

            <?php if (isset($this->transaction)): ?>
                <div class="update"><input type="submit" class="update" value="UPDATE"/></div>
            <?php else: ?>
                <div class="next"><input type="submit" class="next" value="NEXT" /></div>
            <?php endif; ?>
        </div>
        <div style="clear: both;">&nbsp;</div>
        <input type='hidden' name='altField' id='altField'/>
    </form>
</div>